//
//  TWCorrelationCell.swift
//  EyepetizerImitative
//
//  Created by 田伟 on 2017/3/24.
//  Copyright © 2017年 个人. All rights reserved.
//

import UIKit

protocol TWCorrelationCellDelegate : NSObjectProtocol {
    func correlationCellAboutButtonDidClick(correlationModel : TWCorrelationModel)
}

class TWCorrelationCell: UITableViewCell {

    @IBOutlet weak var aboutButton: UIButton!
    @IBOutlet weak var tw_collectionView: TWCorrelationCollectionView!
    // 分割线
    @IBOutlet weak var tw_lineView: UIView!
    
    @IBAction func aboutButtonClick() {
        correlationCellDelegate?.correlationCellAboutButtonDidClick(correlationModel: correlationModel!)
    }
    var correlationCellDelegate : TWCorrelationCellDelegate?
    
    var correlationModel : TWCorrelationModel?{
        didSet {
            guard let correlationModel = correlationModel else {
                return
            }
            let titleStr = (correlationModel.header?.title)! + " >"
            aboutButton.setTitle(titleStr, for: .normal)
            tw_collectionView.tw_correlationModel = correlationModel
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    
}
